//
//  VCOfProvice.m
//  09--HomeWork
//
//  Created by 冀永金 on 16/7/26.
//  Copyright © 2016年 冀永金. All rights reserved.
//

#import "VCOfProvice.h"
#import "VCOfArea.h"
@interface VCOfProvice ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableviewOfProvice;

@end

@implementation VCOfProvice

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = self.name;
    self.tableviewOfProvice = [[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];
    [self.view addSubview:self.tableviewOfProvice];
    self.tableviewOfProvice.delegate = self;
    self.tableviewOfProvice.dataSource = self;
        // Do any additional setup after loading the view.
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.arrOfBig.count;
   
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"pool"];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"pool"];
    }
    NSString *name = [self.arrOfBig [indexPath.row] objectForKey:@"cityName"];
    NSArray *arr = [name componentsSeparatedByString:@" "];
    cell.textLabel.text = arr[2];
    cell.detailTextLabel.text = [arr lastObject];
    
   
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    VCOfArea *area = [[VCOfArea alloc]init];
    [self.navigationController pushViewController:area animated:YES];
    NSMutableArray *marr = [NSMutableArray array];
    for (NSDictionary *dic in self.arrOfBig) {
        NSString *name = [dic objectForKey:@"areaArr"];
        [marr addObject:name];
    }
    area.arrOfArea = marr[indexPath.row];
    }

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
